<template>
  <div class="body1" style="padding-top:10px;">
    <div class="form_select">
      <div>
          <el-select class="select_option1" size="small" v-model="year" placeholder="请选择年份">
            <el-option
              v-for="item in yearArr"
              :key="item"
              :label="item"
              :value="item">
            </el-option>
          </el-select>
          <el-button type="primary"  size="small" @click="getList">&nbsp;搜&nbsp;&nbsp;索&nbsp;</el-button>
      </div>
      <div class="select_right">
          <el-button type="primary"  size="small" @click="exportExcel">导出Excel</el-button>
      </div>
    </div>
    <yearTable :list="list"></yearTable>
  </div>
</template>

<script>
import yearTable from "./yearTable"
import {excelExport} from "../../public/excelExport"
  export default {
    data() {
      return {
        list:[],
        form:{},
        yearArr:[],
        year:'全部'
      };
    },
    components: {
      "yearTable": yearTable
    },
    created: function() {
      this.getYear()
    },
    methods: {
      getYear:function(){
        var that = this
        this.$get('form/year',{}).then((res) => {
          that.yearArr = res.data
          that.getList()
        })
      },
      getList:function(){
        this.form.store_id = localStorage.getItem('store_id')
        this.form.year = this.year
        var that = this
        this.$get('form/yearList',this.form).then((res) => {
          that.list = res.data
        })
      },
      exportExcel:function() {
        let title = '公司年报表'
        excelExport(title)
        return false;
      }
  }
};
</script>
<style>



</style>